(function(){
	var BASE_URL = 'http://www.bjguahao.gov.cn/';
//	var TARGET_URL = 'http://www.bjguahao.gov.cn/dpt/appoint/142-200039484.htm';
	var TARGET_URL = 'http://www.bjguahao.gov.cn/dpt/appoint/142-200039534.htm';
	chrome.browserAction.onClicked.addListener(function(currentTab){
		if(currentTab.url.indexOf(BASE_URL)<0){
			chrome.tabs.getAllInWindow(function(tabs){
				var open;
				for(var i=0;i<tabs.length;i++){
					if(tabs[i].url.indexOf(TARGET_URL)>=0){
						open = true;
						chrome.tabs.update(tabs[i].id, {selected:true});
					}
				}
				if(!open){
					chrome.tabs.create({selected:true, url:TARGET_URL});
				}
			});
		}
	});
})();
